POV-Ray : Newsgroups : povray.general : marching cube macro : marching cube macro Server Time
7 Aug 2024 11:19:11 EDT (-0400)
  marching cube macro  
From: Mael
Date: 27 Sep 2001 10:56:47
Message: <3bb33e2f$1@news.povray.org>
hi,

i found some c code for the marching cube algorithm
(http://astronomy.swin.edu.au/pbourke/modelling/polygonise/) and translate
it into a pov3.5 macro. This algorithm creates a mesh given a scalar
function of (x,y,z) and an iso-level (so it tesselates an isosurface..)

don t know if this can be useful (in fact i m sure it s useless, but it was
fun to programm :)

the macro and an example can be found here :
http://195.221.122.126/tmp/marching.html

usage :
#include "marching cube.inc"
marching("my_function",thresold,box_min,box_max,steps,file_out)

my_function : a string, the function of the isosurface (you must put it into
"")
thresold : a float, the iso level you want
box_min,box_max : two vectors = bounding box
steps : a vector with the number of steps in each direction x,y,z
file_out : a string, the output file , at the end it will contain the mesh

ex :
marching("dodca",1.5,<-10,-10,-10>,<10,10,10>,<50,50,50>,"poly.inc")

the algo computes the function for all points of a steps.x*steps.y*steps.z
grid , so don t use too large values for the number of steps !
i ve not done too much tests, so it might be buggy..

M


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.